//
//  ServiceBase.h
//  Protocol
//
//  Created by  user on 11-1-13.
//  Copyright 2011 GuangZhouXuanWu. All rights reserved.
//

#import <Foundation/Foundation.h>

@class CProtocolBase;
@class CProtocolStream;
@class CSocketChannel;
@class XMSHttpChannel;
@class CGWService;

@protocol CGWServiceDelegate <NSObject>

@optional
-(void)GWService:(CGWService*)service willSendTotalBytes:(NSUInteger)bytes;

-(void)GWService:(CGWService*)service hadSendBytes:(NSUInteger)bytes;

@end

@interface CGWService : NSObject
{
//	id<CSocketChannelDelegate> m_senddelegate;
}

@property(nonatomic,assign) id<CGWServiceDelegate> delegate;;
//@property(nonatomic,assign) BOOL m_bIgnoreoob;
@property(nonatomic,assign) NSTimeInterval sendTimeout;
@property(nonatomic,assign) NSTimeInterval recvTimeout;
@property(nonatomic,readonly) BOOL requesting;

//废弃
//-(id)initWithIP:(NSString*)szIP port:(int)nPort;
//废弃
//-(int)InitStream;
//废弃
//-(void)CloseStream;
//废弃
//-(int)SendService:(CProtocolStream*)request;
//废弃
//-(int)RecvService:(CProtocolStream*)response;
//废弃
//-(int)Query:(CProtocolBase*)protocol output:(NSObject**)obj protocolerror:(NSError**)error;
//废弃
//-(void)terminateService;
///////

///////////

-(id)initWithSocketChannel:(NSString*)szIP port:(int)nPort;

//废弃
-(int)Query2:(CProtocolBase*)protocol output:(NSObject**)obj protocolerror:(NSError**)error XW_DEPRECATED();

-(BOOL)terminateService;

-(XLGResult*)sendProtocol:(CProtocolBase*)protocol;

//废弃
-(NSInteger)sendProtocol:(CProtocolBase*)protocol recvOutput:(NSObject**)output protocolError:(NSError**)error XW_DEPRECATED();

-(NSInteger)createLongConnectSocketChannel:(NSString*)szIP port:(int)port;

-(void)closeLongConnectSocketChannel;

-(XLGResult*)longConnectSendProtocol:(CProtocolBase*)protocol;

//-(int)createLongConnectHTTPChannel:(NSString*)URL;

@end
